package cate.game.activity.specall.msg;

import cate.common.annotation.OperationSetter;
import cate.common.table.d.GDOperation;
import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.activity.specall.SpeCallActivity;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBSpeCall;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "独立卡池召唤-召唤的请求")
@OperationSetter(value = GDOperation.SPE_CALL_EXE, sub = "type")
public class SpeCallExeReq implements MsgInput {
    @NoteField("功能id")
    public int funcId;
    @NoteField("召唤类型")
    public int type;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        SpeCallActivity single = cc.getRole().getActivity().getEnableActivitySingle(funcId);
        if (single == null) {
            cc.getRole().getGame().notice.message(cc.getRole(), "活动未开启");
            return;
        }
        GameResult<SpeCallActivity> result = single.callExe(type);
        if (!result.ok()) {
            game.notice.message(cc.getRole(), result.message);
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBSpeCall.EXE_REQ;
    }
}
